In week 3, we had to start programming our robot so we focused mainly on the programming part because time was running out.
Before we actually started to program the arm, we had to define each position for each servo. The reason was because a human arm cannot be moved freely in any direction, such as moving it or rotating the arm to go behind the body. So the first thing was to set the constraints for each servo where we defined the initial position, minimum position and maximum position, in our case upper position, lower position and initial position. The initial position allowed us to program it so that the arm always start of as if we have relaxed our arm to simply hang down. The upper position for each servo represents the maximum position and the lower position represents the minimum position. These names were used to allow easier code reading while programming the arm.
The programming was done by using Urbiscript as we have already mentioned, and it had to be programmed through the terminal. Basically we have files which finish with the extension ".u" and we were able to edit the files through a text editor and write the code in there, but when we had to run the code we had to actually run it through the terminal, because the .u file had to be loaded on Urbi. When we started programming the servos, we experienced a few problems, where we had to fiddle around with the servos in order to fix the problem. The problem we had was that the servos only had a 300 degree movement. That means that each servo had a position where it could not stop so we had to find the blind spot on each servo and place it accordingly. This caused us problems at first because if we wanted to stop servo A in mid-position to point straight, well if that was the blind spot the servo would not stop there and it would simply skip that position and go to the next available position, or it would not execute the command since that was it's blind spot so the way we fixed this was simply to reverse the servos positions and that fixed the problem.
Before we actually started all the programming we had to use a software called RoboPlus which had the Dynamixel Wizard that allowed us to reset the servos, define the ID for each servo, set the baud rate, set the speed of the servos, and also be able to find the blind spot of the servos by manually controlling them through that software. The dead/blind spots of the servos do not cause us any problems because a real human arm cannot move in any position as we have already mentioned, and the dead/blind spots of the servos come in exactly the spots where the human arm cannot move.
In this part both Dean and Thibault contributed equally again because; 1st, we both had to get the system up and running to see if the arm can work on both Mac and Linux. The 2nd part was to store the positions in variables. So the way we found the positions of each servo was pretty straight forward. Dean had to move the servos manually to the positions which we wanted, while Thibault had to execute the appropriate command on the Terminal/Command-window that displayed the current position of the servo (classname.servoname.position;). Once we printed out a position, we had to of course write it down so that we could later store it into a variable which would be used for setting the constraints.
Once the problems were sorted, we were able to do simple scripts such as moving the arm up and down, left and right and rotate it. This script was used to test if each servo was working efficiently and we also created another script within the class file so that it resets the servos to the initial positions. Dean also created a wood-based support for the arm so we do not need to take it each time we need to test it.
The method we used to do it was pretty simple, but that was just the start. The tools and parts that we have used were:
1. Circular Saw.
2. Cordless Electric Drill.
3. Hand Saw.
4. Screws and Nails.
5. Mitre Box.
6. Flat MDF board.
7. Softwood Squared Lumber.
8. Electric Isolation Tape (Could have used any tape).
9. Cable Tie Tightener.
Below are some pictures of the arm once attached:
CODE for Week 3
load the dynamixel library and create a variable that will use the dynamixel library load("dynamixel.u"); var Global.d = Dynamixel.new;
class roboArm { function init()create a function that initialises each servo { define a variable with each servo and ID var this.shoulder1 = Dynamixel.Device.new(d,17,Dynamixel.DeviceDesc.AX12); var this.shoulder2 = Dynamixel.Device.new(d,9,Dynamixel.DeviceDesc.AX12); var this.shoulderRot = Dynamixel.Device.new(d,2,Dynamixel.DeviceDesc.AX12); var this.elbow = Dynamixel.Device.new(d,6,Dynamixel.DeviceDesc.AX12);
create variables and store positions for each servo var this.shoulder1.iniPos = -1.47; var this.shoulder1.upperPos = 1.6; var this.shoulder1.lowerPos = -2;
var this.shoulder2.iniPos = 1.27; var this.shoulder2.upperPos = -1.83;
var this.shoulderRot.iniPos = -0.03; var this.shoulderRot.maxLeft = -1.45; var this.shoulderRot.maxRight = 0.57;
var this.elbow.iniPos = 1.58; var this.elbow.upperPos = -0.57; };
function reset()create a function that would put each servo in the initial position when executed { var delay = 0.5; this.shoulder1.targetPos = this.shoulder1.iniPos; sleep(delay); this.shoulder2.targetPos = this.shoulder2.iniPos; sleep(delay); this.shoulderRot.targetPos = this.shoulderRot.iniPos; sleep(delay); this.elbow.targetPos = this.elbow.iniPos; };
function sM()another function sM (simpleMovement) that is used to test if each servo works fine { var delay = 1.5;
The code was written by both Thibault and Dean. Each of us was mostly involved in creating different functions and then we reviewed each other's work.
Also, during this week, we started to think about what kind of housing we could create. We wanted to find a material flexible enough so it does not block the servo motors but in the same time it should create a nice curved shape around the arm. The initial idea was to use balloons to cover the arm and create an illusion of muscles. We would probably also need some other soft matter so the balloons are not directly stuck on the motors and the shape is more curved.
This is what we have done for the third week, and we have planned that for the last week, we will decorate the robotic arm, create more scripts, control the arm through the keyboard, create an interface which will allow users to control the arm with mouse clicks.
Week 3 Progress
In week 3, we had to start programming our robot so we focused mainly on the programming part because time was running out.
Before we actually started to program the arm, we had to define each position for each servo. The reason was because a human arm cannot be moved freely in any direction, such as moving it or rotating the arm to go behind the body. So the first thing was to set the constraints for each servo where we defined the initial position, minimum position and maximum position, in our case upper position, lower position and initial position. The initial position allowed us to program it so that the arm always start of as if we have relaxed our arm to simply hang down. The upper position for each servo represents the maximum position and the lower position represents the minimum position. These names were used to allow easier code reading while programming the arm.
The programming was done by using Urbiscript as we have already mentioned, and it had to be programmed through the terminal. Basically we have files which finish with the extension ".u" and we were able to edit the files through a text editor and write the code in there, but when we had to run the code we had to actually run it through the terminal, because the .u file had to be loaded on Urbi. When we started programming the servos, we experienced a few problems, where we had to fiddle around with the servos in order to fix the problem. The problem we had was that the servos only had a 300 degree movement. That means that each servo had a position where it could not stop so we had to find the blind spot on each servo and place it accordingly. This caused us problems at first because if we wanted to stop servo A in mid-position to point straight, well if that was the blind spot the servo would not stop there and it would simply skip that position and go to the next available position, or it would not execute the command since that was it's blind spot so the way we fixed this was simply to reverse the servos positions and that fixed the problem.
Before we actually started all the programming we had to use a software called RoboPlus which had the Dynamixel Wizard that allowed us to reset the servos, define the ID for each servo, set the baud rate, set the speed of the servos, and also be able to find the blind spot of the servos by manually controlling them through that software. The dead/blind spots of the servos do not cause us any problems because a real human arm cannot move in any position as we have already mentioned, and the dead/blind spots of the servos come in exactly the spots where the human arm cannot move.
In this part both Dean and Thibault contributed equally again because; 1st, we both had to get the system up and running to see if the arm can work on both Mac and Linux. The 2nd part was to store the positions in variables. So the way we found the positions of each servo was pretty straight forward. Dean had to move the servos manually to the positions which we wanted, while Thibault had to execute the appropriate command on the Terminal/Command-window that displayed the current position of the servo (classname.servoname.position;). Once we printed out a position, we had to of course write it down so that we could later store it into a variable which would be used for setting the constraints.
Once the problems were sorted, we were able to do simple scripts such as moving the arm up and down, left and right and rotate it. This script was used to test if each servo was working efficiently and we also created another script within the class file so that it resets the servos to the initial positions. Dean also created a wood-based support for the arm so we do not need to take it each time we need to test it.
The method we used to do it was pretty simple, but that was just the start. The tools and parts that we have used were:
1. Circular Saw.
2. Cordless Electric Drill.
3. Hand Saw.
4. Screws and Nails.
5. Mitre Box.
6. Flat MDF board.
7. Softwood Squared Lumber.
8. Electric Isolation Tape (Could have used any tape).
9. Cable Tie Tightener.
Below are some pictures of the arm once attached:
CODE for Week 3
load the dynamixel library and create a variable that will use the dynamixel library
load("dynamixel.u");
var Global.d = Dynamixel.new;
class roboArm
{
function init() create a function that initialises each servo
{
define a variable with each servo and ID
var this.shoulder1 = Dynamixel.Device.new(d,17,Dynamixel.DeviceDesc.AX12);
var this.shoulder2 = Dynamixel.Device.new(d,9,Dynamixel.DeviceDesc.AX12);
var this.shoulderRot = Dynamixel.Device.new(d,2,Dynamixel.DeviceDesc.AX12);
var this.elbow = Dynamixel.Device.new(d,6,Dynamixel.DeviceDesc.AX12);
create variables and store positions for each servo
var this.shoulder1.iniPos = -1.47;
var this.shoulder1.upperPos = 1.6;
var this.shoulder1.lowerPos = -2;
var this.shoulder2.iniPos = 1.27;
var this.shoulder2.upperPos = -1.83;
var this.shoulderRot.iniPos = -0.03;
var this.shoulderRot.maxLeft = -1.45;
var this.shoulderRot.maxRight = 0.57;
var this.elbow.iniPos = 1.58;
var this.elbow.upperPos = -0.57;
};
function reset() create a function that would put each servo in the initial position when executed
{
var delay = 0.5;
this.shoulder1.targetPos = this.shoulder1.iniPos;
sleep(delay);
this.shoulder2.targetPos = this.shoulder2.iniPos;
sleep(delay);
this.shoulderRot.targetPos = this.shoulderRot.iniPos;
sleep(delay);
this.elbow.targetPos = this.elbow.iniPos;
};
function sM() another function sM (simpleMovement) that is used to test if each servo works fine
{
var delay = 1.5;
reset();
sleep(delay);
this.shoulder1.targetPos = this.shoulder1.upperPos;
sleep(delay);
this.shoulder1.targetPos = this.shoulder1.lowerPos;
sleep(delay);
this.shoulder1.targetPos = this.shoulder1.iniPos;
sleep(delay);
this.shoulder2.targetPos = this.shoulder2.upperPos;
sleep(delay);
this.shoulder2.targetPos = this.shoulder2.iniPos;
sleep(delay);
this.shoulderRot.targetPos = this.shoulderRot.maxLeft;
sleep(delay);
this.shoulderRot.targetPos = this.shoulderRot.maxRight;
sleep(delay);
this.shoulderRot.targetPos = this.shoulderRot.iniPos;
sleep(delay);
this.elbow.targetPos = this.elbow.upperPos;
sleep(delay);
this.elbow.targetPos = this.elbow.iniPos;
sleep(delay);
reset();
};
};
The code was written by both Thibault and Dean. Each of us was mostly involved in creating different functions and then we reviewed each other's work.
Also, during this week, we started to think about what kind of housing we could create. We wanted to find a material flexible enough so it does not block the servo motors but in the same time it should create a nice curved shape around the arm. The initial idea was to use balloons to cover the arm and create an illusion of muscles. We would probably also need some other soft matter so the balloons are not directly stuck on the motors and the shape is more curved.
This is what we have done for the third week, and we have planned that for the last week, we will decorate the robotic arm, create more scripts, control the arm through the keyboard, create an interface which will allow users to control the arm with mouse clicks.